package com.woniuxy.microstockserver.mapper;

import com.woniuxy.microstockserver.bean.PageRequestBean;
import com.woniuxy.microstockserver.bean.StockDetailBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 赵雄伟
 * 商品库存明细mapper
 */
@Mapper
public interface StockDetailMapper {
    /**
     *分页、模糊、分类查询所有商品库存明细
     * @param pageRequestBean
     * @param
     * @return
     */
    List<StockDetailBean> findAllStockDetailBean(@Param("p") PageRequestBean pageRequestBean, @Param("sd") StockDetailBean stockDetailBean);

    /**
     * 新增
     * @param stockDetailBean
     * @return
     */
    @Insert("insert into t_stock_detail_info (fk_goods_id,fk_sd_store_id,sd_out_enter_type,sd_business_num,sd_business_date,sd_es_amount,sd_os_amount,sd_stock_amount) values(#{sd.goodsId},#{sd.sdStoreId},#{sd.sdOutEnterType},#{sd.sdBusinessNum},#{sd.sdBusinessDate},#{sd.sdEsAmount},#{sd.sdOsAmount},#{sd.sdStockAmount})")
    @Options(useGeneratedKeys = true, keyProperty = "sd.id" ,keyColumn="id")
    int saveStockDetailBean(@Param("sd") StockDetailBean stockDetailBean);
}
